package com.chexiehui.jc.ui.fragment;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.widget.TextView;

import com.blankj.utilcode.util.SizeUtils;
import com.chexiehui.jc.R;
import com.chexiehui.jc.base.BaseFragment;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import butterknife.BindView;
import rorbin.q.radarview.RadarData;
import rorbin.q.radarview.RadarView;

/**
 * Author: SongJun.
 * CreateDate: 2019/1/21 0021.
 * Description: 综合对比
 */

public class CarBrandParameterAllFragment extends BaseFragment {
    @BindView(R.id.tv_car_brand_name)
    TextView tvCarBrandName;
    @BindView(R.id.rv_params_radar)
    RadarView mRadarView;

    public static CarBrandParameterAllFragment getInstance() {
        CarBrandParameterAllFragment fragment = new CarBrandParameterAllFragment();
        return fragment;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_car_brand_parameter_all;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        mRadarView.setEmptyHint("无数据");
        List<Integer> layerColor = new ArrayList<>();
        Collections.addAll(layerColor, 0x3300bcd4, 0x3303a9f4, 0x335677fc, 0x333f51b5, 0x33673ab7);
        mRadarView.setLayerColor(layerColor);

        List<String> vertexText = new ArrayList<>();
        Collections.addAll(vertexText, "动力", "油耗", "操控", "配置", "安全", "空间");
        mRadarView.setVertexText(vertexText);

        List<Integer> res = new ArrayList<>();
        Collections.addAll(res, R.mipmap.ic_params_lianghao, R.mipmap.ic_params_youxiu, R.mipmap.ic_params_yiban,
                R.mipmap.ic_params_lianghao, R.mipmap.ic_params_youxiu, R.mipmap.ic_params_yiban);
        mRadarView.setVertexIconResid(res);

        List<Float> values = new ArrayList<>();
        Collections.addAll(values, 3f, 6f, 2f, 7f, 5f, 9f);
        RadarData data = new RadarData(values);
        mRadarView.addData(data);

        List<Float> values2 = new ArrayList<>();
        Collections.addAll(values2, 7f, 1f, 4f, 2f, 8f, 3f);
        RadarData data2 = new RadarData(values2);
        data2.setValueTextEnable(true);
        data2.setVauleTextColor(Color.WHITE);
        data2.setValueTextSize(SizeUtils.dp2px(15));
        data2.setLineWidth(SizeUtils.dp2px(1));
        mRadarView.addData(data2);
    }

    @Override
    public void onResume() {
        super.onResume();
        mRadarView.animeValue(2000);
    }
}
